package cn.changein.framework.base.auth.exception;

import cn.changein.framework.kernel.model.exception.AbstractBaseExceptionEnum;
import lombok.Data;

import static cn.changein.framework.base.auth.exception.enumeration.AuthExceptionEnum.NO_PERMISSION;

/**
 * 没有访问权限

 * @date: 2020-02-11
 * @copyright: 广州澄境科技有限公司
 */
@Data
public class PermissionException extends RuntimeException {

    private Integer code;
    private String errorMessage;

    public PermissionException() {
        super(NO_PERMISSION.getMessage());
        this.code = NO_PERMISSION.getCode();
        this.errorMessage = NO_PERMISSION.getMessage();
    }

    public PermissionException(AbstractBaseExceptionEnum exception) {
        super(exception.getMessage());
        this.code = exception.getCode();
        this.errorMessage = exception.getMessage();
    }

}
